package com.yitao.cms.task;

import com.yitao.cms.service.product.ProductTaskLowerShelfService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Date: 2019/6/28 16:10
 * @Author: Kien
 */
@Component
public class ProductLowerShelfTask {
    @Autowired
    private ProductTaskLowerShelfService productTaskLowerShelfService;
    protected static Logger logger = LoggerFactory.getLogger(ProductLowerShelfTask.class);

    /**
     * 30分钟执行一次定时任务，将失效商品下架
     */
    @Scheduled(cron = "0 0/30 * * * ?")
    private void lowerShelfTask(){
        logger.info("开始执行任务");
        productTaskLowerShelfService.updateProductIsSale();
        logger.info("任务执行完毕");
    }

}
